package cn.tedu.administration.controller;

import cn.tedu.administration.pojo.dto.MeetingQuery;
import cn.tedu.administration.pojo.dto.MeetingSaveParam;
import cn.tedu.administration.pojo.vo.MeetingVO;
import cn.tedu.administration.service.MeetingService;
import cn.tedu.base.response.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RequestMapping("/v1/meeting")
@RestController
public class MeetingController {
    @GetMapping("load")
    public JsonResult load (MeetingQuery meetingQuery){
        log.debug("这是查询的第一次出现:"+meetingQuery);
        List<MeetingVO>  list= meetingService.load(meetingQuery);
        log.debug("这是回家的路"+list);
        return JsonResult.ok(list);
    }


    @Autowired
    private MeetingService meetingService;

    @PostMapping("save")
    public JsonResult save(MeetingSaveParam meetingSaveParam) {
        log.debug("这是会议室保存数据的第一次出现：{}", meetingSaveParam);
        meetingService.save(meetingSaveParam);

        return JsonResult.ok();
    }





    @PostMapping("delete/{id}")
    public  JsonResult delete(@PathVariable Long id){
        log.debug("这是删除房间号的第一次出现：{}",id);
        meetingService.delete(id);
        return  JsonResult.ok();
    }
}
